//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
  },
  // 登录处理
  loginEvent: function () {
    wx.login({
      success: function (res) {
        // 获得用户信息保存到本地存储
        if (res.code) {
          wx.getUserInfo({
            success: function (res) {
              wx.setStorageSync('avatarUrl', res.userInfo.avatarUrl);
              wx.setStorageSync('nickName', res.userInfo.nickName)
            }
          })
          wx.switchTab({
            url: '/pages/home/home',
          })
        }
      }
    })
  },
  onLoad: function () {

  },

})
